package com.yunchang.springboot.utils.mwsutils;

import com.yunchang.springboot.mapper.mwsutils.CwfzCurrencyCountryMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class GetCountryByCurrency {

    /**
     * 货币类型与国家的转化
     */
    private static CwfzCurrencyCountryMapper cwfzCurrencyCountryMapper;

    @Autowired
    public void setCwfzCurrencyCountryMapper(CwfzCurrencyCountryMapper cwfzCurrencyCountryMapper){
        GetCountryByCurrency.cwfzCurrencyCountryMapper = cwfzCurrencyCountryMapper;
    }

    public static String getCountryByCurrency(String currency){
        if(StringUtils.isEmpty(currency)){
            log.error("传入的币别类型为空，货币类型与国家的转化工具！");
            return "";
        }
        return cwfzCurrencyCountryMapper.getCountryByCurrency(currency);
    }

}
